<?php

namespace Login\Form;

use Zend\Form\Form;

class LoginForm extends Form {
	public function __construct($name = null) {
		parent::__construct ( 'login' );
		// $this->setAttribute('action', '/');
		$this->setAttribute ( 'method', 'post' );
		$this->setInputFilter(new \Login\Form\LoginFormFilter());
		
		$this->add ( array (
				'name' => 'username',
				'options' => array (
						'label' => 'Username' 
				),
				'type' => 'Text',
				'attributes' => array (
						'class' => 'form-control',
				       'required' => 'required' 
				),
				'required' => true 
		)
		 );
		
		$this->add ( array (
				'name' => 'password',
				'options' => array (
						'label' => 'Password' 
				),
				'type' => 'Password',
				'attributes' => array (
						'class' => 'form-control',
				       'required' => 'required' 
				) 
		) );
		
	   $this->add ( array (
				'name' => 'rememberme',
				'options' => array (
						'label' => 'Remember Me?' 
				),
				'type' => 'checkbox' 
		) );
		
		$this->add ( array (
				'name' => 'submit',
				'options' => array (
						'label' => 'Login' 
				),
				'attributes' => array (
						'value' => 'Login',
						'class' => 'btn btn-default' 
				),
				'type' => 'submit',
				'id' => 'submitbutton' 
		)
		 );
		
		// We could also define the input filter here, or
		// lazy-create it in the getInputFilter() method.
	}
}